package com.sky.mapper;

import com.sky.entity.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.context.annotation.Scope;

import java.util.List;

@Mapper
public interface CategoryMapper {

   List<Category> list(Integer type);

   //根据分类id查询分类名称
    @Select("select category.name from category where id=#{id}")
    Category getCategoryName(Long id);

    //条件分页查询
    List<Category> page(String name, Integer type);

    //添加 分类
    void save(Category category);

    //删除 分类
    @Delete("delete from category where id=#{id}")
    void delete(Long id);

    //修改分类
    void update(Category category);

//    启用禁用
    void setStatus(Integer status, Long id);
}
